<?php

namespace App\Modules\Blog\Resources;

use Illuminate\Http\Resources\Json\Resource;

class CateResource extends Resource
{

    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request
     * @return array
     */
    public function toArray($request)
    {
        //return parent::toArray($request);
	
	return [
		'id' => $this->id,
        'name' => $this->name,
        'title' => $this->title,
        'posts' => PostResource::collection($this->whenLoaded('posts')),
		'created_at' => $this->created_at,
		'updated_at' => $this->updated_at,
        ];
    }

}
